package com.probiz.estore.eai.order;

import java.util.List;

import javax.xml.bind.JAXBElement;

import com.probiz.estore.eai.common.GenericMarshaller;
import com.probiz.estore.eai.exception.EaiException;
import com.probiz.estore.eai.order.generated.Body;
import com.probiz.estore.eai.order.generated.Entry;
import com.probiz.estore.eai.order.generated.Header;
import com.probiz.estore.eai.order.generated.ObjectFactory;
import com.probiz.estore.eai.order.generated.Saleorder;
import com.probiz.estore.eai.order.generated.SaleorderSet;

public class OrderMarshaller extends GenericMarshaller<SaleorderSet>{
	@Override
	public JAXBElement<SaleorderSet> populateEntitySetElement()
			throws EaiException {
		ObjectFactory factory = new ObjectFactory();

		SaleorderSet saleorderSet = factory.createSaleorderSet();
		saleorderSet.setVersion("2.0");
		saleorderSet.setRoottag("saleorder");
		
		
		List<Saleorder> saleorders = saleorderSet.getSaleorder();
		
		Saleorder saleorder = factory.createSaleorder();
		Header header = factory.createHeader();
		header.setMemo("测试备注");
		saleorder.setHeader(header);
		
		Body body = factory.createBody();
		Entry entry = factory.createEntry();
		entry.setInventorycode("SAD232232837");
		body.getEntry().add(entry);
		
		Entry entry1 = factory.createEntry();
		entry1.setInventorycode("SAD0000000");
		body.getEntry().add(entry1);
		
		saleorder.setBody(body);
		
		saleorders.add(saleorder);
		
		JAXBElement<SaleorderSet> orderSetElement=factory.createUfinterface(saleorderSet);
		
		return orderSetElement;
	}
}
